package com.lk.demo.a.controller;

import brave.Tracer;
import org.apache.http.client.utils.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * Created by wangzhanjin on 2018/4/12.
 */
@RestController
public class HelloController {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    Tracer tracer;

    @Value("${tomas:aaa}")
    private String defaultName;

    @GetMapping("/hello")
    public String hello(String name) throws InterruptedException {
         //Thread.sleep(10000l);
        logger.info("#### hello! 【我已经到这了】");
        logger.error("@@@ shit! 【那你嘚瑟吧】"+new Date());
        this.tracer.currentSpan().tag("error","%% I'M 【科比布莱恩特】");
        //this.tracer.addTag("error","%% I'M 【科比布莱恩特】");
        return null==name?defaultName:name+"Hello World";
    }
}